/**
 * 系统首页统计API
 */
import request from '@/utils/request'

/**
 * 获取系统统计数据
 * @returns {Promise}
 */
export function getStatistics() {
  return request({
    url: '/dashboard/statistics',
    method: 'get'
  })
}

/**
 * 获取最近搜索记录
 * @param {Number} limit - 数量限制
 * @returns {Promise}
 */
export function getRecentSearches(limit = 10) {
  return request({
    url: '/dashboard/recent-searches',
    method: 'get',
    params: { limit }
  })
}

/**
 * 获取客户端状态分布
 * @returns {Promise}
 */
export function getClientStatusDistribution() {
  return request({
    url: '/dashboard/client-status',
    method: 'get'
  })
}

/**
 * 获取活动时间线
 * @param {Number} limit - 数量限制
 * @returns {Promise}
 */
export function getActivityTimeline(limit = 20) {
  return request({
    url: '/dashboard/activity-timeline',
    method: 'get',
    params: { limit }
  })
}

/**
 * 清理离线客户端记录
 * @returns {Promise}
 */
export function cleanOfflineClients() {
  return request({
    url: '/dashboard/clean-offline-clients',
    method: 'delete'
  })
}

